package com.ssy.lingxi.platform.template.service.repository;

import com.ssy.lingxi.platform.template.service.entity.adorn.PageTemplate;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PageTemplateRepository extends JpaRepository<PageTemplate, Long> {

    PageTemplate findByTypeAndStatusAndSiteIdAndShopId(Integer type, Integer status, Long siteId, Long shopId);

    PageTemplate findByEnvironmentAndTypeAndStatusAndSiteIdAndShopId(Integer environment, Integer type, Integer status, Long siteId, Long shopId);

    PageTemplate findByEnvironmentAndTypeAndStatusAndSiteId(Integer environment, Integer type, Integer status, Long siteId);

    List<PageTemplate> findByTypeAndSiteIdAndStatusAndAllow(Integer type, Long siteId, Integer status, Integer allow);

    List<PageTemplate> findByTypeAndShelfAndAllow(Integer type, Integer shelf, Integer allow);

    List<PageTemplate> findByTypeAndAllow(Integer type, Integer allow);

    PageTemplate findByTypeAndStatusAndSiteId(Integer code, Integer status, Long siteId);

    List<PageTemplate> findByEnvironmentAndTypeAndStatusAndShelfAndShopId(Integer environment, Integer type, Integer status, Integer shelf, Long shopId);

    List<PageTemplate> findByTypeAndStatusAndShelfAndShopId(Integer type, Integer status, Integer shelf, Long shopId);

    List<PageTemplate> findByEnvironmentAndTypeAndStatusAndShelf(Integer environment, Integer type, Integer status, Integer shelf);

    Page<PageTemplate> findByEnvironmentAndTypeAndAllow(Integer environment, Integer type, Integer allow, Pageable pageable);

    List<PageTemplate> findAllBySiteIdAndShopIdAndEnvironmentAndType(Long siteId, Long shopId, Integer environment, Integer type);

    List<PageTemplate> findAllBySiteIdAndEnvironmentAndType(Long siteId, Integer environment, Integer type);

    List<PageTemplate> findByTypeAndStatusAndShopId(Integer type, Integer status, Long shopId);

    List<PageTemplate> findByEnvironmentAndTypeAndStatusAndShopId(Integer code, Integer code1, Integer code2, Long shopId);

    List<PageTemplate> findByEnvironmentAndTypeAndStatus(Integer environment, Integer type, Integer status);
}
